﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApplication1.Forms;

namespace WindowsFormsApplication1
{
    public partial class FormLogin : Form
    {
        public FormLogin()
        {
            InitializeComponent();
        }

        //用户登录
        private void buttonEnter_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == string.Empty)
            {
                MessageBox.Show("名称不能为空");
                textBox1.Clear();//清空名称文本框
                textBox1.Focus();//文本框获得焦点
                return;
            }
            if (textBox2.Text == string.Empty)
            {
                MessageBox.Show("密码不能为空");
                textBox2.Clear();
                textBox2.Focus();
                return;
            }
            if (!textBox1.Text.Equals("admin"))
            {
                MessageBox.Show("名称错误");
                textBox1.Clear();//清空名称文本框
                textBox1.Focus();//文本框获得焦点
                return;
            }
            if (!textBox2.Text.Equals("admin"))
            {
                MessageBox.Show("密码错误");
                textBox2.Clear();
                textBox2.Focus();
                return;
            }
            else
            {

                MessageBox.Show("欢迎登录本系统!", "消息提示");
                textBox1.Clear();
                textBox2.Clear();
                FormMain1 fm1 = new FormMain1();
                fm1.Show();
                this.Hide();
            }
        }

        //取消按钮
        private void buttonCancel_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            textBox2.Clear();
            textBox2.Focus();
        }

       
    }
}
